import 'package:flutter/material.dart';

class CommonFloatingButton extends StatelessWidget {
  final String? title; // 按钮标题
  final Function? onTap;

  const CommonFloatingButton({super.key, this.title, this.onTap}); // 点击事件

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        if(onTap != null) onTap!();
      },
      child: Container(
        height: 40.0,
        margin: const EdgeInsets.all(20.0),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10.0),
          color: Colors.green,
        ),
        child: Center(
          child: Text(
            title!,
            style: const TextStyle(
                color: Colors.white,
                fontSize: 18.0,
                fontWeight: FontWeight.bold),
          ),
        ),
      ),
    );
  }
}
